package view
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import org.hamcrest.mxml.collection.InArray;

	public class AstarEditGrid extends Sprite
	{
		public function AstarEditGrid(data:Array,index:int,value:int,color:uint)
		{
			this._data=data;
			this._index=index;
			this._value=value;
//			onClick(null);
			draw(color);
		}
		
		//*************** private *************
		private function draw(color:uint):void
		{
			this.graphics.clear();
//
//			if(_value<_stateColor.length)
//			{
//				var colo:uint=_stateColor[_value];
				if(_value==0)
					this.graphics.beginFill(color,0);
				else
					this.graphics.beginFill(color,0.7);
				this.graphics.drawRect(0,0,40,30);
				this.graphics.endFill();
//			}
			drawLine();
		}
		
		private function drawLine():void
		{
			this.graphics.lineStyle(1,0xf0f000,.8);
			graphics.lineTo(40,0);
			graphics.lineTo(40,30);
			graphics.lineTo(0,30);
			graphics.lineTo(0,0);
		}
//		/** 交换阻挡 */
//		public function exChane():void
//		{
//			if(_value==0)
//				_value=1;
//			else
//				_value=0;
//			
//			draw();
//	
//			_data[_index]=_value;
//		}
		/** 更新到特定的值 */
		public function updateTo(value:int,color:uint):void
		{
			this._value=value;
			_data[_index]=_value;
			draw(color);
		}
		
		//******************8 属性 *************
		private  static var _stateColor:Array=[0x0,0xffffff,0xebcc3e,0x3ee5eb,0xeb8f3e,0x9c7325,0x095aff];//[0xffffff,0xffc000,0x0cff00,0x002aff];
		
		private var _data:Array;
		private var _index:int;
		private var _value:int;

		public function get data():Array
		{
			return _data;
		}

		public function set data(value:Array):void
		{
			_data = value;
		}

		public function get index():int
		{
			return _index;
		}

		public function set index(value:int):void
		{
			_index = value;
		}

		public function get value():int
		{
			return _value;
		}

		public function set value(value:int):void
		{
			_value = value;
		}


	}
}